<?php
if($this->session->userdata['user_login']){

?>

<?php $this->load->view('admin/header_layout'); ?>


<div class="row">
    <div class="btn-group">
        <?php echo anchor('admin/topic', 'Topics', 'class="btn"'); ?>
        <?php echo anchor('threads/', 'Threads', 'class="btn active"'); ?>
        <?php echo anchor('admin/replied', 'Replied', 'class="btn"'); ?>
        <?php echo anchor('admin/other_request/other_requested', 'Other Request', 'class="btn"'); ?>
    </div>
</div>
<br />
<div class="marg20-btm">
    <a href="<?php echo site_url('threads/add_new'); ?>" class="btn btn-primary">&#43; Add New </a>
</div>

<br />
<table class="table table-bordered table-striped">
    <thead>
        <tr>
            <th><input type="checkbox" class="check-all" value="" /></th>
            <th>ID</th>
            <th>Topics</th>
            <th>Title</th>
            <th>Content</th>
            <th>Publish Date</th>
            <th>Author</th>
            <th>Status</th>
            <th>Action </th>
        </tr>
    </thead>
    <tbody>
        <?php
        if ($forum_threads->num_rows() > 0) {
            foreach ($forum_threads->result() as $row) {
                //if($row->role_ID == 2){
                echo '
                               <tr>
                                 <td><input type="checkbox" /></td>
                                 <td>' . $row->thread_id . '</td>
								 <td>' . $row->topic_title . '</td>
								 <td>' . $row->thread_title . '</td>
								 <td>' . $row->thread_content . '</td>
								 <td>' . $row->thread_dated . '</td>
								 <td>' . $row->role_name . '</td>
                                 <td>' . $row->thread_status . '</a></td>
								 
                                 <td>
                                     <a onClick="return confirm(\'Are you sure to update ?\')" href=' . site_url('threads/select_edit_thread') . '/' . $row->thread_id . '  rel="tooltip" title="Edit" class="btn btn-primary"><i class="icon-edit"></i></a>
                                     <a href=' . site_url('threads/delete_thread') . '/' . $row->thread_id . ' rel="tooltip" title="Delete" class="btn btn-danger" onClick="return confirm(\'Are you sure to delete ?\')"><i class="icon-trash"></i></a>
                                 </td>
                               </tr>';
                //}
            }
        }
        ?>
    </tbody>
</table>
<div class="form-inline">
    <select>
        <option />Bulk Actions 
        <option />Delete 
    </select>
    <input type="submit" value="Submit" class="btn btn-primary" onClick="return confirm('Are you sure ?');" />
</div>
<div class="pagination">
    <ul>
        <ul>
            <li><?php echo $pages; ?></li>
        </ul>
    </ul>
</div>
</div>

<?php
}else{
	redirect(base_url());
}
?>

